<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>常用选择器</title>
    <script src="../../js/jquery.1.8.3.min.js"></script>
    <script>

        $(function () {
            //1:id选择器
            var username = $("#username");
            console.log("jquery:" + username.val());

            var name = document.getElementById("username");
            console.log("js:" + name.value);

            //2：元素选择器
            var lis = $("li");
            for (var i = 0; i < lis.length; i++) {
                console.log("元素选择器：" + lis[i].innerHTML)
            }

            //3:类选择器
            var datas = $(".database");
            for (var i = 0; i < datas.length; i++) {
                console.log("类选择器：" + datas[i].innerHTML)
            }

            var java = $("#java");
            console.log(java);
        });
    </script>
</head>
<body>
    <input id="username" value="钱多多"/>
    <ul>
        <li id="java" value="java">java</li>
        <li class="database">Oracle</li>
        <li>Hibernate</li>
        <li class="database">Mysql</li>
        <li id="mybatis">MyBatis</li>
    </ul>
</body>
</html>